﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CSharpDesign.DAL;
using CSharpDesign.Scripts;

namespace CSharpDesign.Admin
{
    public partial class wuliu : System.Web.UI.Page
    {
        SqlHelper data = new SqlHelper();
        public string OrderStite;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string id = Request.QueryString["Orderid"].ToString();



                SqlHelper data = new SqlHelper();
                SqlDataReader dr;
                string sql = "select * from GouWuChe where Orderid='" + id + "'";
                dr = data.GetDataReader(sql);
                dr.Read();
                OrderStite = dr["OrderStite"].ToString();
                TextBox1.Text = dr["WuLiu"].ToString();

                Label1.Text = dr["KuaiDi"].ToString();

            }

        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string id = Request.QueryString["Orderid"].ToString();




            SqlHelper data = new SqlHelper();
            SqlDataReader dr;
            string sql = "select * from GouWuChe where Orderid='" + id + "'";
            dr = data.GetDataReader(sql);
            dr.Read();
            OrderStite = dr["OrderStite"].ToString();
            if (OrderStite == "待收货")
            {

                data.RunSql("update GouWuChe set  WuLiu='" + TextBox1.Text + "' where Orderid='" + id + "'");
                Alert.AlertAndRedirect("操作成功", "OrderManger.aspx");
            }
            else
            {
                Alert.AlertAndRedirect("订单状态不允许更改物流信息！", "OrderManger.aspx");
            }
        }
    }

}